import request from '@/utils/request'

export function listRole(data) {
  return request({
    url: '/admin/HtRole/list',
    method: 'post',
    data: data
  })
}

// 查询角色列表
/*
export function listRole(query) {
  return request({
    url: '/auth/system/role/list',
    method: 'get',
    params: query
  })
}
*/
// 查询角色详细
export function getRole(id) {
  return request({
    url: `/admin/HtRole/info`,
    method: 'get',
    params:{
      id
    }
  })
}

// getRoleForEdit
export function getRoleForEdit(id) {
  return request({
    url: `/admin/HtRole/${id}`,
    method: 'get'
  })
}
// 新增角色

export function addRole(data) {
  return request({
    url: '/admin/HtRole/create',
    method: 'post',
    data: data
  })
}
/*
export function addRole(data) {
  return request({
    url: '/auth/system/role/add',
    method: 'post',
    data: data
  })
}
*/
export function updateRole(data) {
  return request({
    url: '/admin/HtRole/update',
    method: 'put',
    data
  })
}
// 修改角色
/*
export function updateRole(data) {
  return request({
    url: '/auth/system/role/update',
    method: 'post',
    data: data
  })
}
*/
// 角色数据权限
export function dataScope(data) {
  return request({
    url: '/auth/system/role/dataScope',
    method: 'post',
    data: data
  })
}

// 角色状态修改
export function changeRoleStatus(roleId, status) {
  const data = {
    roleId,
    status
  }
  return request({
    url: '/auth/system/role/changeStatus',
    method: 'put',
    data: data
  })
}

// 删除角色
/*
export function delRole(roleId) {
  return request({
    url: '/auth/system/role/' + roleId,
    method: 'delete'
  })
}
*/
export function delRole(data) {
  return request({
    url: '/admin/HtRole/delete',
    method: 'post',
    data
  })
}


// 导出角色
export function exportRole(query) {
  return request({
    url: '/auth/system/role/export',
    method: 'get',
    params: query
  })
}

// 角色列表 新
export function listRole2(data) {
	return request({
	  url: '/hr/api/HrRole/list',
	  method: 'post',
	  data
	})
}


